package com.ck.util;

import sun.misc.BASE64Decoder;

import java.io.FileOutputStream;

public class RecordUtil {
    /**
     * 将base64字符解码保存文件
     * @param base64Code
     * @param targetPath
     * @throws Exception
     */

    public static String decoderBase64File(String base64Code, String targetPath)
            throws Exception {
        byte[] buffer = new BASE64Decoder().decodeBuffer(base64Code);
        String fileName = System.currentTimeMillis()+".wav";
        FileOutputStream out = new FileOutputStream(targetPath+"/"+fileName);
        out.write(buffer);
        out.close();
        return fileName;
    }
}
